package com.eastfair.venuebooking.api;

import com.eastfair.core.base.R;
import com.eastfair.venueservice.dto.ExhibitionServiceProviderQuery;
import com.eastfair.venueservice.dto.ServiceProviderDTO;
import com.eastfair.venueservice.vo.ExhibitionServiceProviderVO;
import com.eastfair.venueservice.vo.ServiceProviderVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 服务商 feign.
 *
 * @author dqq
 * @date 2022 /7/15
 */
@FeignClient(value = "venue-services-manage/serviceProvider")
public interface ServiceProviderFeign {

    /**
     * 查询服务商列表.
     *
     * @param query the query
     * @return the r
     */
    @PostMapping("/query/serviceProvider")
    R<List<ServiceProviderVO>> queryServiceProvider(@RequestBody ServiceProviderDTO query);

    /**
     *  cms同步查询服务商列表
     * @return
     */
    @PostMapping("/cms/sync")
    R<List<ServiceProviderVO>> queryCrmSyncServiceProvider();

    /**
     * id查询服务商详情.
     *
     * @param id the id
     * @return the by id
     */
    @GetMapping("/get/{id}")
    R<ServiceProviderVO> getById(@PathVariable("id") Long id);

    /**
     * 用户ID查询服务商信息.
     *
     * @param userId              the user id
     * @param serviceProviderType the service provider type
     * @return the by user id
     */
    @GetMapping("/user/get")
    R<ServiceProviderVO> getByUserId(@RequestParam("userId") Long userId,
                                     @RequestParam("serviceProviderType") String serviceProviderType);

    /**
     * 提交服务商信息.
     *
     * @param serviceProviderDTO the service provider dto
     * @return the r
     */
    @PostMapping("/submit")
    R<Boolean> submitServiceProvider(@RequestBody ServiceProviderDTO serviceProviderDTO);

    /**
     * 更新服务商为已失效.
     *
     * @param serviceProviderType the service provider type
     * @return the r
     */
    @GetMapping("/update/disable")
    R<Boolean> updateServiceProviderDisable(@RequestParam("serviceProviderType") String serviceProviderType);

    /**
     * 新增服务商信息.
     *
     * @param serviceProviderDTO the service provider dto
     * @return the r
     */
    @Deprecated
    @PostMapping("/save")
    R<Boolean> saveServiceProvide(@RequestBody ServiceProviderDTO serviceProviderDTO);

    /**
     * 更新服务商.
     *
     * @param serviceProviderDTO the service provider dto
     * @return the r
     */
    @Deprecated
    @PostMapping("/update")
    R<Boolean> updateServiceProvide(@RequestBody ServiceProviderDTO serviceProviderDTO);

    /**
     * 更新服务商crm同步状态为已同步.
     *
     * @param ids the ids
     * @return the r
     */
    @PostMapping("/update/crm/sync")
    R<Boolean> updateCrmHasSync(@RequestBody List<Long> ids);

    /**
     * 查询展会服务商
     *
     * @param query 查询展会服务商
     * @return R
     */
    @PostMapping("/queryExhibitionServiceProvider")
    R<List<ServiceProviderVO>> queryExhibitionServiceProvider(@RequestBody ExhibitionServiceProviderQuery query);

    /**
     * 展会ID获取负责展馆的服务商.
     *
     * @param exhibitionId        the exhibition id
     * @param spaceCode           the space code
     * @param serviceProviderType the service provider type
     * @return the service provider vo map by exhibition id
     */
    @GetMapping("/get/serviceProvider/map")
    R<Map<String, List<ServiceProviderVO>>> getServiceProviderVOMapByExhibitionId(@RequestParam("exhibitionId") Long exhibitionId,
                                                                                  @RequestParam("spaceCodeList") List<String> spaceCode,
                                                                                  @RequestParam("serviceProviderType") String serviceProviderType);

    /**
     * 展会ID和展厅编码查询负责的主场.
     *
     * @param exhibitionId the exhibition id
     * @param spaceCode    the space code
     * @return the home by exhibition id and space code
     */
    @GetMapping("/get/home")
    R<ServiceProviderVO> getHomeByExhibitionIdAndSpaceCode(@RequestParam("exhibitionId") Long exhibitionId,
                                                           @RequestParam("spaceCode") String spaceCode);

    /**
     * 查询展会未同步的所有展会服务商关系
     *
     * @return R
     */
    @ApiOperation(value = "查询展会未同步的所有展会服务商关系", notes = "查询展会未同步的所有展会服务商关系")
    @PostMapping("/queryNeedSyncExhibitionProvider")
    R<List<ExhibitionServiceProviderVO>> queryNeedSyncExhibitionProvider();

    /**
     * 查询服务商id集合.
     *
     * @param params the params
     * @return the r
     */
    @PostMapping("/queryServiceProviderIds")
    R<List<Long>> queryServiceProviderIds(@RequestBody ServiceProviderDTO params);
}